package cn.jiyun.examples;

import cn.jiyun.config.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(NameException.class)
    public R exceptionHandler(NameException e){
        e.printStackTrace();
        return R.error(e.getMessage()+"已存在");
    }
}
